#ifndef _MYSQL_PREPARED_STATEMENT_H_
#define _MYSQL_PREPARED_STATEMENT_H_

#include "statement.h"

namespace sql
{

	class Statement;
	class Connection;

	class PreparedStatement : public Statement
	{
	public:
#define PREPARE_STMT_MAX_COUNT		( 50 )
	private:
		sql::Connection* mMysqlConnection;
		MYSQL_STMT* 	 mStmt;
		MYSQL_BIND		 mBind[ PREPARE_STMT_MAX_COUNT ];
		bool			 mIsDelete[ PREPARE_STMT_MAX_COUNT ];

	public:

		PreparedStatement( MYSQL_STMT* stmt, sql::Connection* mysql_handle );

		virtual ~PreparedStatement( ) { close( ); }

		ResultSet* executeQuery( const char* sql ) { return NULL; }
		uint32_t executeUpdate( );
		void close( );

		void setInt( unsigned int parameterIndex, int32_t value );
		void setUInt( unsigned int parameterIndex, uint32_t value );
		void setString( unsigned int parameterIndex, const char* value );
		void setBlob( unsigned int parameterIndex, const char* value, uint32_t value_length );

	public:
		static uint32_t getStmtParameMaxCount( ) { return PREPARE_STMT_MAX_COUNT; }
		//	static BufferSizePair allocate_buffer_for_type( enum_field_types t );
	};

}

#endif


